<!DOCTYPE html>
<!--  4、将数组排序。 -->
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<script type="text/javascript">
		var array = [ 45, 12, 58, 123, 78, 56, 34, 52 ];
		/* var min;
		for (var i = 0; i < array.length; i++) {
			for (var j = i; j < array.length; j++) {
				if (array[i] > array[j]) {
					min = array[j];
					array[j] = array[i];
					array[i] = min;
				}
			}
		} */
		array.sort(function(a,b){
			return a-b;
		});
		document.write(array.toString() + "<br />");
	</script>
</body>
</html>